﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using V5_Model;
using V5_BLL;
using V5_Common;

namespace V5_EShop.Controls
{
    public partial class getAnnounceList : BasicControl
    {
        string paramValue="";

        public string ParamValue
        {
            get { return paramValue; }
            set { paramValue = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                Bind_rpList();
            }
        }

        private void Bind_rpList()
        {
            Repeater rp = (Repeater)this.FindControl("rpList");
            if (rp != null)
            {
                int row = 10;
                string strWhere = "",where="",fieldorder=" ID Desc ";
                if (paramValue.Length > 0 && paramValue != "")
                {
                    row = Input.SetInt(Input.TagVal(ParamValue, "row"));
                    if (row < 1)
                    {
                        row = 10;
                    }
                    where = Input.SetString(Input.TagVal(ParamValue, "where"));
                    if (where.Trim() != "")
                    {
                        strWhere += " and " + where;
                    }
                }
                List<ModelAnnounce> listannounce = new BLLAnnounce().GetModelList(row,strWhere,fieldorder);
                rp.DataSource = listannounce;
                rp.DataBind();
            }
        }
    }
}